<?php
    /* @author huguoli
     * @time 2020.6.5
     * 书本详情页 
     * */
require_once '../inc/config.php';/* 得到session_start */
require_once '../inc/section.php';
require_once '../inc/user.php';
require_once '../inc/book.php';
require_once 'header.php';
/*$PageSize=8;//页面容量
 $sectionId=$_GET["sectionId"];//板块编号
 $curPage = $_GET['currentPage'];//设置当前是第几页
 $bookList=findListbook($curPage, $sectionId);//分页取指定版块的帖子列表
 $pages=ceil(40/$PageSize);//计算总页数
 */
        $bookId=$_GET["bookId"];
        
        $book=findbookId($bookId);
        $bookName=$book["bookName"];
?>
<!DOCTYPE html>
<html>
<head>
	<base target="_blank" />
	<meta charset="UTF-8">
		<title><?php echo $bookName;?></title>
		<link rel="stylesheet" href="../css/book.css">
		<script type="text/javascript" src="../inc/jquery-2.1.1.min.js"></script>
		<script src="../script/index.js"></script>
	</head>
	<body>
	<div class="book">
	        <?php  
	              
		          $li="";                  
                  $bookPic=$book["bookPic"];
                  $writer=$book["writer"];                        
                  $introduction=$book["introduction"];
                  $firstTime=$book["firstTime"];
                  $sectionId=$book["sectionId"];
                  $section=getSectionId($sectionId);
                  $sectionName=$section["sectionName"];
                  $label=findLabel($sectionId);  //
                  $li.=<<<li
                  <p style="font-size:48px;font-family:方正粗黑宋简体;color:#494949">$bookName</p>
                  <div class="xiaobox1"><img src="../image/book/$bookPic"  width="190px" height="230px";/></div>
                  <div class="xiaobox2">
                     <p style="font-size:22px;">作者：$writer</p>
                     <p style="font-size:22px;">类别：$sectionName</p>
                     <p style="font-size:22px;">出版时间：$firstTime</p>
                     <p style="font-size:22px;">书本简介：$introduction</p>
                  </div>
li;
           echo $li;      //输出图书信息  ?>
	</div><!-- /book -->
	
	<div class="book2">
	     <?php 
	     for ($i=0;$i<count($label);$i++){
	         $strlabel=$label[$i]["xlabel"];
	         $la.=<<<la
	         <div class="spa">$strlabel</div>
la;
	     }
	     echo $la;      //输出标签信息
	     ?>
	</div><!-- /book2 -->
	
	<div class="book3">
	 <div class="book4"><p style=" font-size: 28px; color: #007722;"><?php echo $bookName;?>的书评  · · · · · · </p></div>
	    
	 <div class="book5">
		<div class="xiaobox3"><img src="../image/pan.png"  width="32px" height="32px"/></div>
		<div class="xiaobox4">
		
		<?php 
		$ls.=<<<ls
		<a href="postExperience.php?bookId=$bookId&bookName=$bookName&sectionId=$sectionId">写书评</a>
ls;
		echo $ls;      //跳转发表书评页面
		?>
		
		</div><!-- /book4 -->
	</div><!-- /book5 -->

	    <p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>
	    <?php 
	    $review=findReview($bookId);	
	    
	     for ($i=0;$i<count($review);$i++){
	         	         
	         $reviewId=$review[$i]["reviewId"];        
	         $title=$review[$i]["title"];
	         $content=$review[$i]["content"];
	         $reviewtime=$review[$i]["reviewtime"];
	         $uId=$review[$i]["uId"];
	         $user=getUserId($uId);
	         $head=$user["head"];
	         $uName=$user["uName"];	         
	         $good=$review[$i]["good"];	         
	         $labelId=$review[$i]["labelId"];
	         $labels=findRevLabel($labelId);
	         $label=$labels["label"];

	         
	         $ll.=<<<ll
	         <div>
	             <div class="head"><img src="../image/head/$head"  width="50px" height="50px";/></div>
                  <div class="head2"><p style="font-size:22px;">$uName</p></div>
                 <div class="head3"><p style="font-size:22px;">$reviewtime</p></div>
                 <div class="head4">
                 <p style="font-size:22px;"><a href="../style/review.php?reviewId=$reviewId" target="_Blank">$title</a></p>
                 <p style="font-size:22px;">$content</p>  
ll;
            if($labelId!=1){
                $ll.=<<<ll
                 <div class="spa2">$label</div>
ll;
	         }
	         
	         $ll.=<<<ll
                </div>
	         </div>
             <p>------------------------------------------------------------------------------------------------------------------------------------------------------------------------------</p>

ll;
	     }
	     echo $ll;      //输出书评信息
	     ?>
	</div><!-- /book3 -->
	

<?php require_once 'footer.php';?>
</body>
</html>